#pragma once

#include <iostream>
#include <string>
#include <cerrno>

#define NORMAL 1
#define WARNIG 2
#define DEBUG  3
#define FATAL  4

#define LOG(LEVEL, MESSAGE) log(#LEVEL, MESSAGE, __FILE__, __LINE__)  // #的作用是将宏转化成字符串
//另外__FILE and __LINE__ 都是C/C++的宏，__FILE__会替换成当前源代码文件的文件名,__LINE__会替换成当前源代码的行号

void log(std::string level,std::string message,std::string file,int line)
{
    std::cout << "[" << level << "]" << "[" << time(nullptr) << "]" << "[" << message << "]" << "[" << file << " : " << line << "]" << std::endl;
}